.class public Lcom/waiqin365/h5/photo/WqStartUpload;
.super Lorg/apache/cordova/CordovaPlugin;


# instance fields
.field a:Ljava/text/SimpleDateFormat;

.field b:Ljava/util/Calendar;

.field c:Ljava/lang/String;

.field private d:Lorg/apache/cordova/CallbackContext;

.field private e:Lorg/apache/cordova/WqCordovaActivity;


# direct methods
.method public constructor <init>()V
    .locals 1

    invoke-direct {p0}, Lorg/apache/cordova/CordovaPlugin;-><init>()V

    const-string/jumbo v0, ""

    iput-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->c:Ljava/lang/String;

    return-void
.end method

.method static synthetic a(Lcom/waiqin365/h5/photo/WqStartUpload;)Lorg/apache/cordova/WqCordovaActivity;
    .locals 1

    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    return-object v0
.end method


# virtual methods
.method public execute(Ljava/lang/String;Lorg/apache/cordova/CordovaArgs;Lorg/apache/cordova/CallbackContext;)Z
    .locals 8

    const/4 v2, 0x0

    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->cordova:Lorg/apache/cordova/CordovaInterface;

    invoke-interface {v0}, Lorg/apache/cordova/CordovaInterface;->getActivity()Landroid/app/Activity;

    move-result-object v0

    check-cast v0, Lorg/apache/cordova/WqCordovaActivity;

    iput-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    iput-object p3, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->d:Lorg/apache/cordova/CallbackContext;

    const/4 v0, 0x0

    :try_start_0
    invoke-virtual {p2, v0}, Lorg/apache/cordova/CordovaArgs;->getString(I)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->c:Ljava/lang/String;

    new-instance v0, Ljava/text/SimpleDateFormat;

    const-string/jumbo v1, "yyyy-MM-dd HH:mm:ss SSS"

    invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->a:Ljava/text/SimpleDateFormat;

    invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;

    move-result-object v0

    iput-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->b:Ljava/util/Calendar;

    new-instance v3, Ljava/util/ArrayList;

    invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

    const-string/jumbo v0, ""

    new-instance v1, Lorg/json/JSONObject;

    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->c:Ljava/lang/String;

    invoke-direct {v1, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string/jumbo v0, "filePathList"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_3

    const-string/jumbo v0, "filePathList"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v4

    move v0, v2

    :goto_0
    invoke-virtual {v4}, Lorg/json/JSONArray;->length()I

    move-result v5

    if-ge v0, v5, :cond_1

    new-instance v5, Ljava/io/File;

    invoke-virtual {v4, v0}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v6

    const-string/jumbo v7, "path"

    invoke-virtual {v6, v7}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v6

    invoke-direct {v5, v6}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v5}, Ljava/io/File;->exists()Z

    move-result v6

    if-eqz v6, :cond_0

    invoke-interface {v3, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_1
    if-eqz v3, :cond_2

    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v0

    if-gtz v0, :cond_4

    :cond_2
    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    const v1, 0x7f08080e

    invoke-virtual {v0, v1}, Lorg/apache/cordova/WqCordovaActivity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p3, v0}, Lorg/apache/cordova/CallbackContext;->error(Ljava/lang/String;)V

    move v0, v2

    :goto_1
    return v0

    :cond_3
    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    const v1, 0x7f080615

    invoke-virtual {v0, v1}, Lorg/apache/cordova/WqCordovaActivity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p3, v0}, Lorg/apache/cordova/CallbackContext;->error(Ljava/lang/String;)V

    move v0, v2

    goto :goto_1

    :cond_4
    const-string/jumbo v0, "url"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_6

    const-string/jumbo v0, "url"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    new-instance v1, Lcom/waiqin365/lightapp/kehu/b/o;

    invoke-direct {v1}, Lcom/waiqin365/lightapp/kehu/b/o;-><init>()V

    invoke-static {}, Lcom/waiqin365/base/login/mainview/a;->a()Lcom/waiqin365/base/login/mainview/a;

    move-result-object v4

    iget-object v5, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    invoke-virtual {v4, v5}, Lcom/waiqin365/base/login/mainview/a;->k(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v4

    invoke-static {}, Lcom/waiqin365/base/login/mainview/a;->a()Lcom/waiqin365/base/login/mainview/a;

    move-result-object v5

    iget-object v6, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    invoke-virtual {v5, v6}, Lcom/waiqin365/base/login/mainview/a;->n(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v5

    iput-object v5, v1, Lcom/waiqin365/lightapp/kehu/b/o;->a:Ljava/lang/String;

    iget-object v5, v1, Lcom/waiqin365/lightapp/kehu/b/o;->a:Ljava/lang/String;

    const-string/jumbo v6, "/fhUpload/"

    invoke-virtual {v5, v6}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z

    move-result v5

    if-nez v5, :cond_5

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    iget-object v6, v1, Lcom/waiqin365/lightapp/kehu/b/o;->a:Ljava/lang/String;

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string/jumbo v6, "/fhUpload/"

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    iput-object v5, v1, Lcom/waiqin365/lightapp/kehu/b/o;->a:Ljava/lang/String;

    :cond_5
    iput-object v4, v1, Lcom/waiqin365/lightapp/kehu/b/o;->b:Ljava/lang/String;

    iput-object v0, v1, Lcom/waiqin365/lightapp/kehu/b/o;->d:Ljava/lang/String;

    const-string/jumbo v0, ""

    iput-object v0, v1, Lcom/waiqin365/lightapp/kehu/b/o;->e:Ljava/lang/String;

    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    invoke-static {v0}, Lcom/fiberhome/upload/b/b;->a(Landroid/content/Context;)Lcom/fiberhome/upload/b/b;

    move-result-object v0

    iget-object v4, v1, Lcom/waiqin365/lightapp/kehu/b/o;->a:Ljava/lang/String;

    iput-object v4, v0, Lcom/fiberhome/upload/b/b;->a:Ljava/lang/String;

    iget-object v4, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    invoke-virtual {v0, v4}, Lcom/fiberhome/upload/b/b;->b(Landroid/content/Context;)V

    const-string/jumbo v0, ""
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1

    :try_start_1
    new-instance v4, Lorg/json/JSONObject;

    invoke-direct {v4}, Lorg/json/JSONObject;-><init>()V

    const-string/jumbo v5, "uploadDir"

    iget-object v6, v1, Lcom/waiqin365/lightapp/kehu/b/o;->d:Ljava/lang/String;

    invoke-virtual {v4, v5, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string/jumbo v5, "uploadHandler"

    iget-object v6, v1, Lcom/waiqin365/lightapp/kehu/b/o;->e:Ljava/lang/String;

    invoke-virtual {v4, v5, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string/jumbo v5, "tenantId"

    iget-object v6, v1, Lcom/waiqin365/lightapp/kehu/b/o;->b:Ljava/lang/String;

    invoke-virtual {v4, v5, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string/jumbo v5, "cmId"

    iget-object v6, v1, Lcom/waiqin365/lightapp/kehu/b/o;->c:Ljava/lang/String;

    invoke-virtual {v4, v5, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string/jumbo v5, "code"

    iget-object v1, v1, Lcom/waiqin365/lightapp/kehu/b/o;->f:Ljava/lang/String;

    invoke-virtual {v4, v5, v1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    invoke-virtual {v4}, Lorg/json/JSONObject;->toString()Ljava/lang/String;
    :try_end_1
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_0
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    move-result-object v0

    move-object v1, v0

    :goto_2
    if-eqz v3, :cond_8

    :try_start_2
    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v0

    if-ge v2, v0, :cond_8

    invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/io/File;

    invoke-virtual {v0}, Ljava/io/File;->isDirectory()Z

    move-result v0

    if-eqz v0, :cond_7

    :goto_3
    add-int/lit8 v2, v2, 0x1

    goto :goto_2

    :cond_6
    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    const v1, 0x7f080813

    invoke-virtual {v0, v1}, Lorg/apache/cordova/WqCordovaActivity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p3, v0}, Lorg/apache/cordova/CallbackContext;->error(Ljava/lang/String;)V

    move v0, v2

    goto/16 :goto_1

    :catch_0
    move-exception v1

    move-object v1, v0

    goto :goto_2

    :cond_7
    new-instance v4, Lcom/fiberhome/upload/b/a;

    invoke-direct {v4}, Lcom/fiberhome/upload/b/a;-><init>()V

    invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/io/File;

    invoke-virtual {v0}, Ljava/io/File;->getName()Ljava/lang/String;

    move-result-object v0

    iput-object v0, v4, Lcom/fiberhome/upload/b/a;->a:Ljava/lang/String;

    invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/io/File;

    invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v0

    iput-object v0, v4, Lcom/fiberhome/upload/b/a;->b:Ljava/lang/String;

    invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/io/File;

    invoke-virtual {v0}, Ljava/io/File;->length()J

    move-result-wide v6

    iput-wide v6, v4, Lcom/fiberhome/upload/b/a;->c:J

    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->a:Ljava/text/SimpleDateFormat;

    iget-object v5, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->b:Ljava/util/Calendar;

    invoke-virtual {v5}, Ljava/util/Calendar;->getTime()Ljava/util/Date;

    move-result-object v5

    invoke-virtual {v0, v5}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, v4, Lcom/fiberhome/upload/b/a;->d:Ljava/lang/String;

    iput-object v1, v4, Lcom/fiberhome/upload/b/a;->e:Ljava/lang/String;

    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    invoke-static {v0}, Lcom/fiberhome/upload/a/c;->a(Landroid/content/Context;)Lcom/fiberhome/upload/a/c;

    move-result-object v0

    invoke-virtual {v0, v4}, Lcom/fiberhome/upload/a/c;->a(Lcom/fiberhome/upload/b/a;)Z

    move-result v0

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v6, "h5 "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    iget-object v4, v4, Lcom/fiberhome/upload/b/a;->a:Ljava/lang/String;

    invoke-virtual {v5, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string/jumbo v5, ":"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/fiberhome/upload/c/a;->a(Ljava/lang/String;)V
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_1

    goto :goto_3

    :catch_1
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    :cond_8
    iget-object v0, p0, Lcom/waiqin365/h5/photo/WqStartUpload;->e:Lorg/apache/cordova/WqCordovaActivity;

    invoke-virtual {v0}, Lorg/apache/cordova/WqCordovaActivity;->getThreadPool()Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    new-instance v1, Lcom/waiqin365/h5/photo/h;

    invoke-direct {v1, p0}, Lcom/waiqin365/h5/photo/h;-><init>(Lcom/waiqin365/h5/photo/WqStartUpload;)V

    invoke-interface {v0, v1}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V

    const/4 v0, 0x1

    goto/16 :goto_1
.end method
